package com.ruoyi.finance.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.finance.domain.AccountsReceivable;
import com.ruoyi.finance.mapper.AccountsReceivableMapper;
import com.ruoyi.finance.service.IAccountsReceivableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 应收账款Service业务层处理
 * 
 * @author liuyu
 * @date 2024-10-28
 */
@Service
public class AccountsReceivableServiceImpl implements IAccountsReceivableService 
{
    @Autowired
    private AccountsReceivableMapper accountsReceivableMapper;

    /**
     * 查询应收账款
     * 
     * @param id 应收账款主键
     * @return 应收账款
     */
    @Override
    public AccountsReceivable selectAccountsReceivableById(Long id)
    {
        return accountsReceivableMapper.selectAccountsReceivableById(id);
    }

    /**
     * 查询应收账款列表
     * 
     * @param accountsReceivable 应收账款
     * @return 应收账款
     */
    @Override
    public List<AccountsReceivable> selectAccountsReceivableList(AccountsReceivable accountsReceivable)
    {
        return accountsReceivableMapper.selectAccountsReceivableList(accountsReceivable);
    }

    /**
     * 新增应收账款
     * 
     * @param accountsReceivable 应收账款
     * @return 结果
     */
    @Override
    public int insertAccountsReceivable(AccountsReceivable accountsReceivable)
    {
        accountsReceivable.setCreateTime(DateUtils.getNowDate());
        return accountsReceivableMapper.insertAccountsReceivable(accountsReceivable);
    }

    /**
     * 修改应收账款
     * 
     * @param accountsReceivable 应收账款
     * @return 结果
     */
    @Override
    public int updateAccountsReceivable(AccountsReceivable accountsReceivable)
    {
        accountsReceivable.setUpdateTime(DateUtils.getNowDate());
        return accountsReceivableMapper.updateAccountsReceivable(accountsReceivable);
    }

}
